import { Link, useSelector, useDispatch, Prompt } from 'umi';
import { useEffect } from 'react';
import _ from 'lodash';
import { Spin } from 'antd';

const Home = () => {
  const data = useSelector((state: any) => ({
    tags: state.tags,
    loading: state.loading.models.tags,
  }));

  const dispath = useDispatch();
  useEffect(() => {
    dispath({
      type: 'tags/fetchTagsList',
    });
  }, []);

  return (
    <>
      <Link to="/admin/dva">去dva</Link>
      {_.map(data.tags?.tagsList, (item, key) => {
        return <h1 key={key}>{item.name}</h1>;
      })}
    </>
  );
};

export default Home;
